﻿@using Hsp.Linux.Net6.Mvc.Models
@model LoginViewModel

@{
    ViewData["Title"] = "Login";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row">
    <div class="col-md-8">
        <section id="loginForm">
            @using (Html.BeginForm("Login", "Account", new { area = "", ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, true, new { @class = "form-horizontal", role = "form" }))
            {
                @Html.AntiForgeryToken()
                <h4>使用本地帐户登录</h4>
                <hr />
                @Html.ValidationSummary(true, "", new { @class = "text-danger" })
                <div class="form-group" style="display:none;">
                    @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.Email, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Email, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    @Html.LabelFor(m => m.PhoneNumber, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.PhoneNumber, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.PhoneNumber, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Password, "", new { @class = "text-danger" })
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(m => m.VerifyCode, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(m => m.VerifyCode, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.VerifyCode, "", new { @class = "text-danger" })
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-10">
                        <img alt="验证码图片" class="img" onclick="refresh(this)" src="/Account/VerifyCode" title="点击刷新">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <div class="checkbox">
                            @Html.CheckBoxFor(m => m.RememberMe)
                            @Html.LabelFor(m => m.RememberMe)
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-offset-2 col-md-10">
                        <button type="submit" class="btn btn-primary">
                            <i class="glyphicon glyphicon-log-in" aria-hidden="true"></i>登录
                        </button>
                        @*<input type="submit" value="登录" class="btn btn-primary" />*@
                        @*<button type="submit" class="btn btn-default">登录</button>*@
                        @base.ViewBag.Msg
                    </div>
                </div>
                @* <p>
                @Html.ActionLink("注册为新用户", "Register")
            </p>
            在为密码重置功能启用了帐户确认后，启用此项
                <p>
                    @Html.ActionLink("忘记了密码?", "ForgotPassword")
                </p>*@
            }
        </section>
    </div>
    <div class="col-md-4">
        <section id="socialLoginForm">
            @*<img src="~/lib/bootstrap/dist/brand/bootstrap-outline.svg" class="img-fluid" />*@
        </section>
    </div>
</div>

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}

    <style type="text/css">

        .img {
            cursor: pointer;
        }

        button i{padding-right:5px;}
    </style>

    <script type="text/javascript">

        function refresh(obj) {
            $(obj).attr("src", "/Account/VerifyCode?random=" + Math.random());
        }

    </script>

}


